<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品列表</title>

<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>

<style type="text/css">
#searchbar{
   margin-bottom: 10px;
   margin-left:15px;
  }
  .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search {
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>

<body style="padding:6px; overflow:hidden;">
<div class="navbar">
		<span>您当前的位置：</span>
		基础数据管理 &gt; 商品让利设置
</div>

<form action="toCommodityList.do" method="post" >
<div id="searchbar">

商品编号：<input type="text" id="commoNo" name="commoNo" value="${commodity.commoNo}">&nbsp;&nbsp;
商品名称：<input type="text" id="commoName" name="commoName" value="${commodity.commoName}" />
         <input type="submit" id="btnSearch" value="查询" class="l-button-search" />
           <input type="button" id="btnReset" value="重置" class="l-button-search" />
</div>

</form>
<div id="maingrid" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- 展示列表数据  -->
</div>

	<script>
    var basePath='${BasePath}';
    var grid = null;
	
    $(function () {
    	 // 重置
        $("#btnReset").click(function(){
    		$('#searchbar :input').not(':submit, :button, :reset').val('').removeAttr('checked').removeAttr('selected');
    	});
    	
        grid = $("#maingrid").ligerGrid({
            columns: [
            { display: '商品编号', name: 'commoNo'},
            { display: '商品名称', name: 'commoName'},
           
            { display: '操作',width:'20%', isSort: false, render: function (rowdata, rowindex, value){
            	var h="";
            	 h += "<a href='javascript:setProfits(" + rowindex + ")'>让利设置</a> &nbsp;&nbsp;&nbsp;&nbsp;";
                return h;
            	}
            }
            ], 
            pageSize:30,
            width: '100%',
            height: '100%',
            dataType: 'server', 
            dataAction: 'server',
            pagesizeParmName: 'pageSize',
            parms: [
					{name: "commoName", value:$("#commoName").val()},
					{name: "commoNo", value:$("#commoNo").val()},
                    ],
			url: "aJaxCommodityList.do"
		
        });
    });
    
    function setProfits(rowindex) {
      var cNo=grid.getData()[rowindex].commoNo;
  	  /* var m=$.ligerDialog.open({title:'让利设置',url:basePath+'/base/ProfitsController/toSetProfits.do?commoNo='+cNo,height:450,width:1000,isResize: false, isDrag: false ,
  		buttons: [{ text: '确定', onclick: function (item, dialog) { 
			dialog.frame.addProfitsData(); 
			if(dialog.frame.isSuccess == "success"){
				dialog.close();
			}
	  }},
      { text: '取消', onclick: function (item, dialog) { 
    	  dialog.close(); } 
	  }]});
  	  m.show(); */
      window.parent.f_addTab('让利设置', '让利设置', basePath+'/base/ProfitsController/toSetProfits.do?commoNo='+cNo+"&pTabid="+WIN_TAB.getSelectedTabItemID());
    }
    
    
    function detailProfits(rowindex){
        var cNo=grid.getData()[rowindex].commoNo;
    	  var m=$.ligerDialog.open({title:'详情',url:basePath+'/base/ProfitsController/toSetProfits.do?commoNo='+cNo,height:450,width:800,isResize: false, isDrag: false ,
    		buttons: [
        { text: '取消', onclick: function (item, dialog) { 
      	  dialog.close(); } 
  	  }]});
    	  m.show();
    }
    
 
  
    </script>
	
</body>
</html>